package com.meida.boot.handler.app;


import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.IndexInterceptor;
import com.meida.module.product.provider.service.ProdShopService;
import com.meida.module.system.provider.service.SysSliderService;
import com.meida.module.product.provider.service.ProdShopTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 商家首页接口
 *
 * @author zyf
 */
@Component("shopIndexHandler")
public class ShopIndexHandler implements IndexInterceptor {

    @Autowired
    private SysSliderService sliderService;

    @Autowired
    private ProdShopService prodShopService;
    @Autowired
    private ProdShopTypeService typeService;


    @Override
    public EntityMap complete(EntityMap params) {
        EntityMap result = new EntityMap();
        //轮播图
        List<EntityMap> sliderList = sliderService.listBySliderType(2, 5);

        //商家分类
        List typeList = typeService.listByTypeCode("ProdShop");
        //附近商家
        List<EntityMap> shopList = prodShopService.listNearby(params, 10, false);

        result.put("sliderList", sliderList);
        result.put("shopList", shopList);
        return result.put("typeList", typeList);
    }
}
